window.addEvent('domready', function() {
	if(navigator.userAgent.indexOf("NetFront") != -1){

		if($('titleArea').offsetHeight<=70){
			$$('.contentsArea').setStyle("padding-top","120px");
		} else if($('titleArea').offsetHeight<=95){
			$$('.contentsArea').setStyle("padding-top","140px");
		} else if($('titleArea').offsetHeight<=120){
			$$('.contentsArea').setStyle("padding-top","160px");
		} else if($('titleArea').offsetHeight<=145){
			$$('.contentsArea').setStyle("padding-top","180px");
		}

	}

	var stepNum = $$('.stepText').length;
	
	if($('stepNum')!=undefined){
		$('stepNum').innerHTML=stepNum
	}

});

function resizeWinodow(){
	$$('.contentsArea').setStyle("display","block");
	
	var browserHeight = document.documentElement.clientHeight;
	var contentsHeight = browserHeight - ($('header').offsetHeight) - ($('logo').offsetHeight) - ($('footer').offsetHeight) + "px"
	var leftrightHeight = browserHeight - ($('logo').offsetHeight) + "px"

	if(browserHeight>120){
		$('rightcolumn').setStyle("height",leftrightHeight);
		$('leftcolumn').setStyle("height",leftrightHeight);
		$$('.contentsArea').setStyle("height",contentsHeight);		
	}
}

function strLength(strSrc){
	len = 0;
	strSrc = escape(strSrc);
	for(i = 0; i < strSrc.length; i++, len++){
		if(strSrc.charAt(i) == "%"){
			if(strSrc.charAt(++i) == "u"){
				i += 3;
				len++;
			}
			i++;
		}
	}
	return len;
}
function showLength(str,name) {
	var strCount = Math.ceil(strLength(str).toString() / 2);
	
	if(strCount>24){
		if(navigator.userAgent.indexOf("NetFront") != -1){
			$("categoryTitle").setStyles({
			        'font-size': '20px',
			        'padding': '17px 0px 0px 0px',

			        'line-height': '120%'
			});

			if($("categoryTitle").offsetHeight<=49){
				$("categoryTitle").setStyles({
				        'font-size': '20px',
				        'padding': '27px 0px 0px 0px',
				        'line-height': '120%',
					'height':'40px',
					'width':'800px'
				});
			}else{
				$("categoryTitle").setStyles({
				        'font-size': '20px',
				        'padding': '17px 10px 0px 0px',
				        'line-height': '120%',
					'width':'800px',
					'height':'60px'
				});
			}
		}else{
			$("categoryTitle").setStyles({
			        'font-size': '20px',
			        'padding': '2px 10px 0px 0px',
			        'line-height': '120%',
				'width':'800px'
			});

			if($("categoryTitle").offsetHeight<=26){
				$("categoryTitle").setStyles({
				        'font-size': '20px',
				        'padding-top': '15px',
				        'line-height': '120%',
					'height':'50px',
					'width':'800px'
				});
			}else{
				$("categoryTitle").setStyles({
				        'font-size': '20px',
				        'padding': '2px 10px 0px 0px',
				        'line-height': '120%',
					'width':'800px',
					'height':'70px'
				});
			}
		}
	}else{
		if(navigator.userAgent.indexOf("NetFront") == -1){
			$("categoryTitle").setStyles({
				'height':'50px'
			});
		}
	}
}


window.onload = function(){
	h1Length=$("categoryTitle").get('text')
	showLength(h1Length,"")

	if(navigator.userAgent.indexOf("NetFront") != -1){
		$$('.contentsArea').setStyle("display","block");
		if($("categoryTitle").get('text')=="Common operations"){
			$("categoryTitle").set('text','Setting original and paper')
		}
	}else{
		resizeWinodow();
	}

	if(location.hash=="#copy"){
		$("categoryTitle").set('text','复印')
	}else if(location.hash=="#printer"){
		$("categoryTitle").set('text','打印机')
	}else if(location.hash=="#fax"){
		$("categoryTitle").set('text','传真')
	}else if(location.hash=="#imageSend"){
		$("categoryTitle").set('text','图象发送')
	}

	DeleteCookie("copyJob");
}
window.onresize = function(){
	if(navigator.userAgent.indexOf("NetFront") != -1){
		$$('.contentsArea').setStyle("display","block");
	}else{
		resizeWinodow();
	}	
}

function popup(obj,id,mx,my) {
	var num=0;
	var selectNumber = document.getElementsByTagName("div");
	
	for(var j=0;j<selectNumber.length;j++){
		sID = selectNumber[j].id;
		if(sID.indexOf('comment')==0){
			num++;
			document.getElementById('comment'+num).style.display='none';
		}
	}
	
	var elm = document.getElementById(id);
	elm.style.display='block';
	elm.style.position='absolute';
	
	myOP = (navigator.userAgent.indexOf("Opera",0) != -1)?1:0;
	myN6 = document.getElementById;
	myIE = document.all;
	myN4 = document.layers;

	
	if (myOP){
		myToolTipOP();
	}else if (myIE){
		myToolTipIE();
	}else if (myN6){
		window.addEventListener("load",myToolTipN6(),true);
	}else if (myN4){
		myToolTipN4();
	}

	function myToolTipOP(){
		elm=document.getElementById(id).style;
		elm.left = mx + window.event.clientX + "px";
		elm.top  = my + window.event.clientY + "px";
	}
	function myToolTipIE(){ 
		elm=document.all[id].style;
		elm.left = mx + window.event.clientX + document.body.scrollLeft + "px";
		elm.top  = my + window.event.clientY + document.body.scrollTop + "px";
	}
	
	function myToolTipN6(myEvent){
		elm=document.getElementById(id).style;
		elm.left = mx + window.event.clientX + "px";
		elm.top  = my + window.event.clientY + "px";

	}
	function myToolTipN4(myEvent){
		elm.left = myX + myEvent.x ;
		elm.top  = myY + myEvent.y ;
	}
}

function popdown(id) {
    document.getElementById(id).style.display='none';
}


function WriteCookie(key, value, days) {
     var str = key + "=" + escape(value) + ";";
     if (days != 0) {
          var dt = new Date();
          dt.setDate(dt.getDate() + days);
          str += "expires=" + dt.toGMTString() + ";";
     }
     document.cookie = str;
}

function ReadCookie(key) {
     var sCookie = document.cookie;
     var aData = sCookie.split(";");
     var oExp = new RegExp(" ", "g");
     key = key.replace(oExp, "");

     var i = 0;
     while (aData[i]) {
          var aWord = aData[i].split("=");
          aWord[0] = aWord[0].replace(oExp, "");
          if (key == aWord[0]) return unescape(aWord[1]);
          if (++i >= aData.length) break;
     }
     return "";
}
function DeleteCookie(key) 
{
     var dt = new Date();
     var str = key + "=;expires=" + dt.toGMTString();
     document.cookie = str;
}


function anchorLink(url){
	if(navigator.userAgent.indexOf("NetFront") != -1){
		obj = document.getElementById(url); 
		y = obj.offsetTop;
		scrollTo(0,y-100);
	}else{
		location.href="#"+url;
	}
}


if(navigator.userAgent.indexOf("NetFront") != -1){
	css1 = "../styles_nf/common.css";
	css2 = "../styles_nf/contents.css";

}else{
	css1 = "../styles/common.css";
	css2 = "../styles/contents.css";
}
var css = '<';	css+='link rel="stylesheet" href=' + css1 + ' \/';	css+='>';
var css = css + '<';	css+='link rel="stylesheet" href=' + css2 + ' id="st-content"' + ' \/';	css+='>';

document.write(css);
